package org.colafries.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author colafries
 * @version v1.0
 * @ClassName DataModelColumnDataTypeEnum
 * @Description
 * @date Created in 2024/3/27
 **/
@Getter
@AllArgsConstructor
public enum ColumnDataTypeEnum {
    DATE("01", "date"),
    STRING("02", "string"),
    INT("03", "int"),
    DOUBLE("04", "double"),
    OTHER("999", "other");

    @EnumValue
    private final String code;
    private final String value;

    public static ColumnDataTypeEnum get(String code) {
        for (ColumnDataTypeEnum dataTypeEnum : ColumnDataTypeEnum.values()) {
            if (dataTypeEnum.getCode().equals(code)) {
                return dataTypeEnum;
            }
        }
        return ColumnDataTypeEnum.OTHER;
    }
}
